import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,AlertController } from 'ionic-angular';
declare let ImagePicker:any


/**
 * Generated class for the ImgpickerPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-imgpicker',
  templateUrl: 'imgpicker.html',
})
export class ImgpickerPage {

  constructor(public navCtrl: NavController, 
              public navParams: NavParams,
              public alertCtrl:AlertController) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad ImgpickerPage');
  }

  chooseimgs(){
    ImagePicker.getPictures(result => {
      this.showAlert(JSON.stringify(result));
  }, err=> {
      this.showAlert(err)
  }, { 
      maximumImagesCount : 9, 
      width : 1920, 
      height : 1440, 
      quality : 100 
  });

  }
  
  showAlert(content) {
    const alert = this.alertCtrl.create({
      title: '提 示',
      subTitle: content,
      buttons: ['确定']
    });
    alert.present();
  }

}
